public class Main {
    public static void animalSpeak(Animal animal) {
        animal.speak();
    }

    public static void main(String[] args) {
        Dog dog = new Dog();
        Cat cat = new Cat();

        animalSpeak(dog);
        animalSpeak(cat);
    }
}